#ifndef TEXT_H_
#define TEXT_H_

#include <SDL/SDL_ttf.h>
#include <list>
#include <vector>
#include "Drawable.h"

namespace JDL
{
  class Text : public Drawable
  {
  public:
    Text(const std::string str, const std::string font, int size);
    virtual ~Text();
    virtual void	Render(SDL_Surface *screen);
    void		SetColor(int r, int g, int b);

  private:
    std::string	_str;
    int		_nb_line;
    std::vector<SDL_Surface*>	_lines;
    TTF_Font	*_font;
    SDL_Rect	_size;
    SDL_Rect	_size_line;
    SDL_Color	_color;
    int		_saut;
    int		_size_font;

    char	*GetToken(const char *str, int *pos);
    void	GetLines();
    int		GetMaxChar(std::list<char*> &tokens);
    void	WriteSurface();
    void	DestroyLines();
    void	CreateTextSurface(int max_char);
    void	Init(const std::string font, int size);
  };
}

#endif
